var tgd = tgd || {};
tgd.Utilities = tgd.Utilities || {};
tgd.Utilities.Calendar = tgd.Utilities.Calendar || {};
tgd.Utilities.Calendar.Views = tgd.Utilities.Calendar.Views || {};

tgd.Utilities.Calendar.Views.TodayPicker = function (canvas) {
	this._canvas = canvas;
	this.onTodayPicked = null;
	this._today = new Date();
	this._todayLink = document.createElement("span");

	var self = this;

	this._todayLink.className = "link";
	this._todayLink.innerHTML = "Today";
	this._todayLink.onclick = function() { self.onTodayPicked(); };

	this._canvas.appendChild(this._todayLink);
	this._canvas.appendChild(document.createTextNode(" is " + tgd.Utilities.Calendar.MonthNames[this._today.getMonth()] + " " + this._today.getDate() + ", " + this._today.getFullYear()));

	if (tgd.Utilities.Calendar.Views.TodayPicker._initialized === undefined) {

		tgd.Utilities.Calendar.Views.TodayPicker.prototype.getMonth = function() {
			return this._today.getMonth();
		}

		tgd.Utilities.Calendar.Views.TodayPicker.prototype.getYear = function() {
			return this._today.getFullYear();
		}

		tgd.Utilities.Calendar.Views.TodayPicker._initialized = true;
	}
}
